<? 
	if(isset($_POST['btngo']))
	{
		require("required/dbconnect.php");
		$pageno=$_POST['pageno'];
		$type=$_POST['type'];
		header("Location:os_ctoviewall.php?page=$pageno&type=$type");
	}
	
		
	$title="Check This Out!"; 
	$pageid="4";
	$accessid="a00";
	require("required/dbconnect.php");
	require("required/share_function.php");
	require("required/header.php");
	
	if(empty($_GET['page']))
	{
		$page="1";
	}
	else
	{
		$page=$_GET['page'];
	}
	
	
	
	$totalperpage=10;

	$from=($page-1)*$totalperpage;	
	
	$get_events=mysql_query("select * from os_checkthisout where status=1 and type=0 order by create_date asc limit $from,$totalperpage")or die(mysql_error());
	$get_total=mysql_query("select * from os_checkthisout where type=0 and status=1");
	
	
		
	
	
?>
<script src="required/js/fieldvalidation.js">
</script>
<script type="text/javascript" src="required/js/calendarDateInput.js">
</script>
<?
	$count=mysql_num_rows($get_total);

	$totalpage=$count/$totalperpage;
	
	if($count%$totalperpage>0)
	{
		if(round($totalpage)>$totalpage)
		{
			$totalpage=round($totalpage);
		}
		else
		{
			$totalpage=round($totalpage+1);
		}
	}
	else
	{
		$totalpage=round($totalpage);
	}
	
	
	$nextpage=$page+1;
	$prepage=$page-1;
	
	
?>
<td align="left" valign="top">
<table width="95%"  cellpadding="2" cellspacing="1">
	<tr>
		<td colspan="3" align="right">
			<table id="Table_01" height="45" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td width="13" rowspan="3" align="right">
						<img src="images/product_title_01.jpg" width="13" height="45" alt=""></td>
					<td width="263" height="10" style="background:url('images/product_title_02.jpg');background-repeat:repeat-x"></td>
					<td width="28" rowspan="3" align="left">
						<img src="images/product_title_03.jpg" width="11" height="45" alt=""></td>
				</tr>
				<tr>
					<td background="images/product_title_04.jpg" height="26">
						Current position <img src="images/arrow.gif"><font style="font-size:12px;font-weight:bolder">Check This Out!</font></a>
					</td>
				</tr>
				<tr>
					<td style="background:url('images/product_title_05.jpg');background-repeat:repeat-x" height="9"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td width="100%" colspan="6" align="left"><br><br>
			<table width="100%" cellpadding="0" cellspacing="0" >
				<td width="69%" height="45">
				<form action="<?= $_SERVER['PHP_SELF'] ?>" method="post">
				<input type="button" class="button" value="<<" onClick="window.open('os_ctoviewall.php?page=1&type=<?= $type ?>','_self')">
				<input type="button" class="button" value="<" onClick="window.open('os_ctoviewall.php?page=<?= $prepage ?>&type=<?= $type ?>','_self')">
				
				Page <input type="text" name="pageno" value="<?= $page ?>" size="2" maxlength="3" class="text"> of <?= $totalpage ?>
				<input type="submit" value="Go" class="button" name="btngo">
				<? if($page==$totalpage){ ?>	
				<input type="button" class="button" value=">" >
				<? }else{ ?>
				<input type="button" class="button" value=">" onClick="window.open('os_ctoviewall.php?page=<?= $nextpage ?>&type=<?= $type ?>','_self')">
				<? } ?>
				<input type="button" class="button" value=">>" onClick="window.open('os_ctoviewall.php?page=<?= $totalpage ?>&type=<?= $type ?>','_self')">
				
				</form>
				
				</td>
				
			</table>
		</td>
	</tr>
	<tr>
		<td width="100%" align="center">
			<table width="100%" class="solidborder">
			<tr bgcolor="#000000" style="color:#FFFFFF;font-weight:bold " align="center">
				<td width="3%">No</td><td width="55%">Title</td><td width="16%">Date</td>
			</tr>
			<?
				
				
				if(mysql_num_rows($get_events)==0)
				{
			?>
			<tr>
				<td align="center" colspan="5"> - no record found -</td>
			</tr>
			<? }
				else
				{
					$no=1;
					while($a=mysql_fetch_array($get_events,MYSQL_ASSOC))
					{
						if($no%2==0)
						{
							$bgcolor="#e5e5e5";
						}
						else
						{
							$bgcolor="#eeeeee";	
							
						} 
						
			?>
				<tr height="20" bgcolor="<?= $bgcolor ?>" onmouseover="this.style.backgroundColor='ccccff'" onmouseout="this.style.backgroundColor='<?= $bgcolor ?>'">
					<td><?= $no ?></td><td align="left"><a href="os_viewcto.php?id=<?= $a['id'] ?>"><font color="#000000"><strong><?= $a['title_eng'] ?></strong></font></td><td><?= $a['create_date'] ?></td>
					
				</tr>
			
			<? 
					$no++;
					}
				} 
			?>
			</table>
		</td>		
	</tr>
</table>
</td>
<? require("required/footer.php"); ?>

